/*
 * Reader.java
 *
 * Created on 15 de octubre de 2006, 18:43
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package ub.es.ubictionary.io;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;

/**
 *
 * @author aram
 */
public class Reader {
    
    
    public Reader() {
    }
    
    public static ArrayList getLines(String file) throws FileNotFoundException, UnsupportedEncodingException, IOException{
        ArrayList v = new ArrayList();
        BufferedReader rdr =  new BufferedReader(new InputStreamReader(new FileInputStream(IOUtil.path + File.separator + file),"UTF-8"));
        String line=null;
        while((line = rdr.readLine()) != null)
            v.add(line);
        
        rdr.close();
        return v;
    }
    
    public static ArrayList getLinesFromExternalFile(String file) throws FileNotFoundException, UnsupportedEncodingException, IOException{
        ArrayList v = new ArrayList();
        BufferedReader rdr =  new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8"));
        String line=null;
        while((line = rdr.readLine()) != null)
            v.add(line);
        
        rdr.close();
        return v;
    }
}
